package com.hivekion.files.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hivekion.files.domain.FileInfo;
import com.hivekion.files.mapper.FileInfoMapper;
import com.hivekion.files.service.IFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FileServiceImpl implements IFileService {

      @Autowired
      FileInfoMapper fileMapper;

      @Override
      public FileInfo findFileByHash(String fileHash) {
	    LambdaQueryWrapper<FileInfo> deptLambdaQueryWrapper = Wrappers.lambdaQuery();
	    deptLambdaQueryWrapper.eq(FileInfo::getFileHash, fileHash);
	    FileInfo fileInfo = fileMapper.selectOne(deptLambdaQueryWrapper);
	    return fileInfo;
      }
}
